<#import "/manage/tpl/pageBase.ftl" as page>
<@page.pageBase currentMenu="扶贫人员管理">
	<form action="${basepath}/manage/user" method="post" theme="simple">
		<div class="table-responsive">
		<table class="table table-bordered">
			<tr>
				<td style="text-align: right; padding-top: 15px" nowrap="nowrap">账号</td>
				<td style="text-align: left;"><input type="text" value="${e.username!""}" name="username"  class="search-query input-small"
						id="username" /></td>


			</tr>
			<tr>
				<td colspan="28">
<#--<%-- 					<s:submit method="selectList" value="查询" cssClass="btn btn-primary"/> --%>-->
<#--<%-- 					<s:a method="selectList" cssClass="btn btn-primary"> --%>-->
<!-- 						<i class="icon-search icon-white"></i> 查询 -->
<#--<%-- 					</s:a> --%>-->
					<button method="toPoverAlleviation" class="btn btn-primary" onclick="selectList(this)">
						<i class="icon-search icon-white" href="toPoverAlleviation"></i> 查询
					</button>
					<button method="toAddPovertyUser" class="btn btn-primary" onclick="selectList(this)">
        				<i class="icon-search icon-white"></i> 添加
    				</button>
				</td>
			</tr>
		</table>
        </div>
		<div class="table-responsive">
		<table class="table table-hover">
			<tr style="background-color: #dff0d8">
                <td nowrap="nowrap">
                    <#--//序列号-->
                </td>
				<th nowrap="nowrap">帐号</th>
				<th nowrap="nowrap">昵称</th>
                <th nowrap="nowrap">手机号</th>
				<th nowrap="nowrap">邮箱</th>
				<th nowrap="nowrap">注册日期</th>
                <th nowrap="nowrap">状态</th>

<!-- 				<th width="150px">冻结时间</th> -->
				<th nowrap="nowrap">操作</th>
			</tr>
			<#list pager.list as item>
				<tr>
                    <td nowrap="nowrap">
						<#--//序列号-->
                    </td>
					<td nowrap="nowrap">
						<#--账号-->
						&nbsp;${item.username!""}
					</td>
						<#--昵称-->
					<td nowrap="nowrap">&nbsp;${item.nickname!""}</td>
						<#--手机号-->
					<td nowrap="nowrap">&nbsp;${item.phone!""}</td>
						<#--邮箱-->
					<td nowrap="nowrap">&nbsp;${item.email!""}</td>
						<#--注册日期-->
					<td nowrap="nowrap">&nbsp;${item.createtime!""}</td>
						<#--状态-->
                    <td>&nbsp;
						<#if item.status=="y">
                            <img alt="显示" src="${basepath}/resource/images/action_check.gif">
						<#else>
                            <img alt="不显示" src="${basepath}/resource/images/action_delete.gif">
						</#if>
                    </td>
					<td nowrap="nowrap">
<#--<%-- 						<s:a href="account!toEdit.action?e.id=%{id}">编辑</s:a> --%>-->
    					<a onclick="initPassword()">初始化密码</a>
						<a href="toShowProvertyUser?username=${item.username!""}">查看</a>
<#--<%-- 						<a href="account!czmm.action?e.id=%{id}">重置密码</s:a> --%>-->
						<a href="toEditProvertyUser?username=${item.username!""}">修改</a>
						<a style="color:red" onclick="doConfirm()">删除</a>
						<input id="hiddenValue" name="hiddenValue" value="${item.username!""}" type="hidden">
						<#--href="toDeleteProvertyUser?username=${item.username!""}"-->
					</td>
				</tr>
			</#list>
			<tr>
				<td colspan="16" style="text-align: center;">
					<#include "/manage/system/pager.ftl"/></td>
			</tr>
		</table>
        </div>
	</form>
<script type="text/javascript">

	function doConfirm(){
        if (confirm("你确定删除吗？")) {
            var _url = "toDeleteProvertyUser?username=" + document.getElementById("hiddenValue").value;
            $.ajax(_url,{
                type: 'POST',
                data: $('#form').serialize(),
                success: function(data){
					//刷新页面
                    window.location.reload();
                },
                error:function(XMLHttpRequest, textStatus, errorThrown){
                    alert("操作失败，请稍后重试!"+_url);
                }
            });
        }
    }

    $(function(){
        //$('table tr:not(:first)').remove();
        var len = $('table tr').length;
        for(var i = 3;i<len-1;i++){
            $('table tr:eq('+i+') td:first').text(i-2);
        }

    });

	function toAddPovertyUser(){
        var _form = $("form");
        _form.attr("action",$(obj).attr("method"));
        _form.submit();
//        window.location.href = "http://" + window.location.host + "/jshop/manage/user/toAddPovertyUser";
    }

	function initPassword(){
        var _url = "initPassword";
        $.ajax(_url,{
            type: 'POST',
            data: $('#form').serialize(),
            success: function(data){
                layer.alert('初始化密码成功,初始密码:000000');
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
                layer.alert('操作失败，请稍后重试!');
            }
        });
	}

	$(function() {
		function c1(f) {
			$(":checkbox").each(function() {
				$(this).attr("checked", f);
			});
		}
		$("#firstCheckbox").click(function() {
			if ($(this).attr("checked")) {
				c1(true);
			} else {
				c1(false);
			}
		});

	});
	function deleteSelect() {
		if ($("input:checked").size() == 0) {
			return false;
		}
		return confirm("确定删除选择的记录?");
	}
</script>

</@page.pageBase>